import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login/login'
import Home from '@/views/home/list'
import Device from '@/views/device/list'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Index',
    component: Home,
    redirect: '/home/device',
    meta: {
      title: '首页'
    }
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    redirect: '/home/list',
    children: [
      {
        path: 'device',
        name: 'DeviceList',
        component: Device,
        meta: {
          title: '设备'
        }
      }
    ],
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {
      title: '登录'
    }
  }
]

const router = new VueRouter({
  // 去掉#号
  mode: 'history',
  // 前缀
  base: '/wechat-salechanel/',
  routes
})

export default router
